{% extends 'home_page/base_index.html' %}
{% load static %}

{% block show_body %}
    <section class="section">
        <div class="card">
            <div class="card-header">管理企业表数据</div>
            <div class="card-body">
                <div class="dataTable-wrapper dataTable-loading no-footer sortable searchable fixed-columns">
                    <div class="dataTable-container">
                        <table class="table table-striped dataTable-table" id="table1">
                            <thead>
                            <tr>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">ID</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">企业名称</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">企业简介</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">企业邮箱</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">手机号</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">地址</a></th>
                                <th data-sortable="" style="width: 12%;"><a href="#" class="dataTable-sorter">注册时间</a></th>
                                <th data-sortable="" style="width: 12%;">
                                    <a href="#" class="dataTable-sorter">操作</a>
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for page in page_obj %}
                            <tr>
                                <td>{{ page.id }}</td>
                                <td>{{ page.name }}</td>
                                <td>{{ page.description }}</td>
                                <td>{{ page.email }}</td>
                                <td>{{ page.phone_number }}</td>
                                <td>{{ page.address }}</td>
                                <td>{{ page.registration_date }}</td>
                                <td>
                                    <form action="{% url 'supervisor:manage_organization' %}" method="post">
                                        {% csrf_token %}
                                        <input type="hidden" value="{{ page.id }}" name="org_id">
                                        <button type="submit"><span class="badge bg-danger">删除</span></button>
                                    </form>
                                </td>
                            </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    <div class="dataTable-bottom">
                        <div class="dataTable-info">显示 {{ page_obj.paginator.count }} 条目中的 {{ page_obj.start_index }} 到 {{ page_obj.end_index }} 个 </div>
                        <ul class="pagination pagination-primary float-end dataTable-pagination">
                            {% if page_obj.has_previous %}
                                <li class="page-item"><a href="?page={{ page_obj.previous_page_number }}" class="page-link">‹</a></li>
                            {% endif %}
                            {% for num in page_obj.paginator.page_range %}
                                {% if page_obj.number == page_number %}
                                    <li class="page-item active"><a href="#" class="page-link">{{ page_number }}</a></li>
                                {% else %}
                                    <li class="page-item"><a href="?page={{ page_number }}" class="page-link">{{ page_number }}</a></li>
                                {% endif %}
                            {% endfor %}
                            {% if page_obj.has_next %}
                                <li class="page-item"><a href="?page={{ page_obj.next_page_number }}" class="page-link">›</a></li>
                            {% endif %}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

{% endblock %}


